﻿using RobotPratolSolution.ViewModels;
using System.Windows;
using System.Windows.Controls;

namespace RobotPratolSolution.Pages
{
    /// <summary>
    /// JobRecordDisplay.xaml 的交互逻辑
    /// </summary>
    public partial class JobRecordDisplay : UserControl
    {
        JobRecordViewModel jobRecordViewModel { get; set; }
        public JobRecordDisplay()
        {
            InitializeComponent();
            jobRecordViewModel = new JobRecordViewModel();
            this.DataContext = jobRecordViewModel;
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            StartTimeDatePickerBox.DisplayDate = DateTime.Now;
            EndTimeDatePickerBox.DisplayDate = DateTime.Now;
            EndTimeDatePickerBox.Text = DateTime.Now.ToString();
            StartTimeDatePickerBox.Text = DateTime.Now.ToString();
        }

        private void QuerryBtn_Click(object sender, RoutedEventArgs e)
        {
            DateTime dateTimestart = StartTimeDatePickerBox.DisplayDate.Date;
            DateTime dateTimestop = EndTimeDatePickerBox.DisplayDate.Date.AddDays(1);
            jobRecordViewModel.JobRecordGet(dateTimestart, dateTimestop);
        }
    }
}
